/* ==============================================================================
 * 创 建 者：lyt
 * 创建日期：2017-07-14	
 * 功能描述：

 * 修 改 人:
 * 修改时间:
 * 修改描述：
 * ==============================================================================*/
//
var SubmitUrl = baseUrl + 'MemberF/UpGrade';
//获取配置
var GetSetUrl = baseUrl + 'MemberF/UpGrade';
//会员信息获取
var getMemberViewUrl = baseUrl + 'MemberF/MemberView';
//票据
var GetJsTicketUrl = baseUrl + 'DefaultMobile/GetJsTicket';



var vu;
var mescroll;
$(function() {
	initVue();

});

function initVue() {
	vu = new Vue({
		el: '#content',
		data: {
			member: '',
			GradeList: [],
			ShowCoins: [], //显示币种
			chooseCoinIndex: '',
			Data: '',
			upgradeType:''
		},
		mounted: function() {
			this.GetSet();
			this.getMemberView();
		},
		methods: {
			GetSet: GetSet,
			Submit: Submit,
			getMemberView: getMemberView,

		}
	})
}

function Submit() {
	if(!vu.chooseCoinIndex) {
		mui.toast("请选择级别");
		return;
	}
	common.post(SubmitUrl, {
		GradeOID: vu.chooseCoinIndex,
        upgradeType:vu.upgradeType,
	}, 'json', function(r) {
		if(r.ErrorCode == 0) {
			mui.toast(r.ErrorMsg);
		} else {
			mui.toast(r.ErrorMsg);
		}
	})

}

function GetSet() {
	common.get(GetSetUrl, {}, 'json', function(r) {
		if(r.ErrorCode == 0) {
			vu.GradeList = r.Data.GradeList;
			vu.activeType = r.Data.activeType;
			vu.Data = r.Data;

		} else {
			mui.toast(r.ErrorMsg);
		}
	})
}

function getMemberView() {
	common.get(getMemberViewUrl, {}, 'json', function(r) {
		if(r.ErrorCode == 0) {
			vu.member = r.Data.member;
		} else {
			mui.toast(r.ErrorMsg);
		}
	})
}